package com.moli.iov.open.web.controller;

import com.moli.iov.open.model.vo.req.VehicleCommandThirdVo;
import com.moli.iov.open.service.IVehicleCommandFacadeService;
import com.moli.iov.rest.RestResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *
 * </p>
 *
 * @author zql
 * @since 2020/4/2 15:01
 */
@Slf4j
@RestController
@RequestMapping("/command")
public class VehicleCommandController extends BaseController {

  @Autowired
  private IVehicleCommandFacadeService vehicleCommandFacadeService;

  /**
   * 控车
   * @param vehicleCommandThirdVo
   * @return
   */
  @RequestMapping("/control")
  public RestResponse sendCommand(@RequestBody @Validated({VehicleCommandThirdVo.Control.class})
      VehicleCommandThirdVo vehicleCommandThirdVo){

    assembleUserInfo(vehicleCommandThirdVo);
    log.info("对外控车接口，参数：{}",vehicleCommandThirdVo.toString());
    return vehicleCommandFacadeService.sendCommand(vehicleCommandThirdVo);
//    return RestResponse.success();
  }
}
